class Listing implements Comparable {
	String      listingName
    	String      address1
    	String      address2
    	String      extNumber
    	String      intNumber
        String      country
    	String      city
        String      state
    	Integer     latitude
    	Integer     longitude
        Date        createdOn
    	SortedSet   pictures
        Integer     picturesCount = 0

    static      hasMany = [pictures : Picture]
    
    static optionals = ['address2', 'latitude', 'longitude']
	static constraints = {
    		listingName(maxLength:50,blank:false)
            address1(maxLength:40,blank:false)
            address2(maxLength:40,blank:true)
            extNumber(maxLength:8,blank:true)
            intNumber(maxLength:8,blank:true)
            city(maxLength:30,blank:false)
            country(inList:['United States', 'Mexico'],blank:false)
    		state(inList:['BCN', 'BCS', 'SIN', 'SON' ,'NAY'],blank:false)
            latitude(maxLength:10,blank:true)
            longitude(maxLength:10,blank:true)
	}

    int compareTo(obj) {        
        obj.id.compareTo(id)
    }

}
